﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using SecurePlayer.SecureService;

namespace SecurePlayer
{
    public class PlayerPlugin : IPlugin
    {
        VlcPlayer _vlcPlayer;

        public void Init()
        {
            _vlcPlayer = new VlcPlayer();
            _vlcPlayer.Reference = this;
            _vlcPlayer.Show();
        }

        public event EventHandler<EventDataType> OnReceiveData;

        public void NotifyServer(EventDataType Data)
        {
            try
            {
                if (OnReceiveData != null)
                {
                    OnReceiveData(this, Data);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

        }

        public void SendData(EventDataType Data)
        {
            try
            {
                _vlcPlayer.ParseData(Data);
            }
            catch (Exception ex)
            {

            }
        }

    }
}
